﻿@using KuaJing.Tasks.Domain
@using Inovout.Descriptor
@model IEnumerable<KuaJing.Tasks.Domain.Task>
<div class="iui-panel">
    <h1>任务查询</h1>
    <div class="row form-inline">
        @using (Html.BeginForm())
            {
            <div class="col-md-10">
                @Html.Query()
            </div>
            <div class="col-md-2">
                @Html.Submit("查询", new { @class = "btn btn-default btn-primary" })
            </div>
        }
    </div>
</div>
<div class="row">
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "任务执行状态统计分析" },
        "tooltip": { "pointFormat": "任务数:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y}" } } },
        "series": [{ "type": "pie", "name": "任务数占比", "data": @ViewBag.StatusReportData
        }]
        }
    </div>
    <div class="col-xs-4 chart">
        {
        "chart":
        {
        "type": "pie",
        "options3d":
        { "enabled": true, "alpha": 45, "beta": 0 }
        },
        "title": { "text": "未完成任务负责人统计分析" },
        "tooltip": { "pointFormat": "任务数:{point.y}\/{point.total}<br />{series.name}: <b>{point.percentage:.1f}%</b>" },
        "plotOptions": {
        "pie": { "allowPointSelect": true, "cursor": "pointer", "depth": 35, "dataLabels": { "enabled": true, "format": "{point.name}:{point.y}" } } },
        "series": [{ "type": "pie", "name": "任务数占比", "data": @ViewBag.AssigneeReportData
        }]
        }
    </div>

</div>
<div class="iui-panel iui-panel-table">
    <h1>
        执行中任务列表
        @if (((IEnumerable<Task>)ViewBag.ExecutingTasks).Any())
        {
            <span class="ico-add">
                @Html.ActionLink("发磅邮件", "SendMail", QueryCriteriaHelper.BuildRouteDictionary(Html.ViewData.GetQueryCriteria(Model), new RouteValueDictionary()))
            </span>
        }
    </h1>
    <div>
        @* @Html.Partial("~/Views/Task/Table.cshtml", (IEnumerable<Task>)ViewBag.ExecutingTasks)*@
        @Html.Table((IEnumerable<Task>)ViewBag.ExecutingTasks, () => "伙伴非常拼命，没有未完成的任务！").Build(properties =>
   {
       properties.Extend("名称", v => Html.ActionLink(v.Name, "Edit", "Task", new { Id = v.Id, ReturnUrl = Request.Url }, new { target = "_blank" }));
       properties.Add(m => m.Assignee);
       properties.Add(m => m.Participants);
       properties.Add(m => m.ExpectedStartDate);
       properties.Add(m => m.ExpectedEndDate);
       properties.Add(m => m.ActualStartDate);
       properties.Add(m => m.ActualEndDate);
       properties.Add(m => m.Status).RenderAs(v => v.ToAlias());
   })
    </div>
</div>
